﻿using System;

namespace UtilZ.Dotnet.Ex.Log
{
    /// <summary>
    /// 日志接口
    /// </summary>
    public interface ILogerCore : IDisposable
    {
        /// <summary>
        /// 日志记录器名称
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// 获取日志级别
        /// </summary>
        LogLevel Level { get; set; }

        /// <summary>
        /// 是否启用日志追加器
        /// </summary>
        bool Enable { get; set; }

        /// <summary>
        /// 需要输出堆栈信息的日志级别
        /// </summary>
        LogLevel[] OutputStackLevels { get; set; }

        /// <summary>
        /// 添加日志追加器
        /// </summary>
        /// <param name="appender">日志追加器</param>
        void AddAppender(IAppender appender);

        /// <summary>
        /// 移除日志追加器
        /// </summary>
        /// <param name="appender">日志追加器</param>
        void RemoveAppender(IAppender appender);

        /// <summary>
        /// 清空日志追加器
        /// </summary>
        void ClearAppender();

        /// <summary>
        /// 根据日志追加器名称获取日志追加器
        /// </summary>
        /// <param name="appenderName">日志追加器名称</param>
        /// <returns>日志追加器</returns>
        IAppender GetAppenderByName(string appenderName);

        /// <summary>
        /// 获取日志追加器
        /// </summary>
        /// <returns>日志追加器数组</returns>
        IAppender[] GetAppenders();

        /// <summary>
        /// Loger添加日志的方法
        /// </summary>
        /// <param name="logItem">日志对象</param>
        void Log(LogItem logItem);

    }
}
